//获取文章数据
import request from 'utils/request'
export const getArticlesList = (params) => {
  return request({
    method: 'GET',
    url: '/mp/articles',
    params,
  })
}
//删除文章
export const delArticles = (id) => {
  return request({
    method: 'DELETE',
    url: `/mp/articles/${id}`,
  })
}
//发布文章
export const addArticles = (data, draft = false) => {
  return request({
    method: 'POST',
    url: '/mp/articles?draft=' + draft,
    data,
  })
}
//根据id获取文章信息
export const getArticleById = (id) => {
  return request({
    method: 'GET',
    url: `/mp/articles/${id}`,
  })
}
// 修改文章
export const editArticle = (data, draft = false) => {
  return request({
    method: 'PUT',
    url: `/mp/articles/${data.id}?draft=${draft}`,
    data,
  })
}
